Charger 25 Click
Charger 25 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : Nenad Filipovic
- Date : Jul 2023.
- Type : I2C type
Software Support
Example Description
This example demonstrates the use of Charger 25 Click board™ by enabling battery charging and displaying battery voltage and charging status.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.Charger25
Example Key Functions
- charger25_cfg_setup Config Object Initialization function.
void charger25_cfg_setup(charger25_cfg_t *cfg)
Charger 25 configuration object setup function.
Charger 25 Click configuration object.
Definition charger25.h:292
- charger25_init Initialization function.
err_t charger25_init(charger25_t *ctx, charger25_cfg_t *cfg)
Charger 25 initialization function.
Charger 25 Click context object.
Definition charger25.h:271
- charger25_default_cfg Click Default Configuration function.
err_t charger25_default_cfg(charger25_t *ctx)
Charger 25 default configuration function.
- charger25_get_vbat Charger 25 get VBAT function.
err_t charger25_get_vbat(charger25_t *ctx, uint16_t *vbat)
Charger 25 get VBAT function.
- charger25_get_status Charger 25 get charging status function.
err_t charger25_get_status(charger25_t *ctx, charger25_status_t *status)
Charger 25 get charging status function.
Charger 25 Click status object.
Definition charger25.h:310
- charger25_get_vbat_lim Charger 25 get battery voltage limit function.
err_t charger25_get_vbat_lim(charger25_t *ctx, uint16_t *vtg_lim)
Charger 25 get battery voltage limit function.
Application Init
Initialization of I2C module and log UART. After driver initialization, the app executes a default configuration.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( I2C_MASTER_ERROR ==
charger25_init( &charger25, &charger25_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
log_printf( &logger, " ----------------\r\n" );
Delay_ms ( 100 );
}
@ CHARGER25_ERROR
Definition charger25.h:382
#define CHARGER25_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition charger25.h:256
void application_init(void)
Definition main.c:43
Application Task
The demo application reads and displays the results of the battery voltage, minimal system voltage, battery voltage limit and charging status. Results are being sent to the UART Terminal, where you can track their changes.
{
static uint16_t vtg_data = 0;
{
charger25_display_status( );
}
Delay_ms ( 100 );
{
log_printf( &logger, " VBAT: %u [mV]\r\n", vtg_data );
}
Delay_ms ( 100 );
{
log_printf( &logger, " VMIN: %u [mV]\r\n", vtg_data );
}
Delay_ms ( 100 );
{
log_printf( &logger, " VLIM: %u [mV]\r\n", vtg_data );
}
log_printf( &logger, " ----------------\r\n" );
Delay_ms ( 1000 );
}
@ CHARGER25_OK
Definition charger25.h:381
err_t charger25_get_vsys_min(charger25_t *ctx, uint16_t *vsys_min)
Charger 25 get VSYS function.
void application_task(void)
Definition main.c:81
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.